// console.log('user-canvas')
// var smoothie = new SmoothieChart();
// var smoothie = new SmoothieChart({
//   grid: { strokeStyle:'rgb(255, 255, 255)', fillStyle:'rgb(255, 255, 255)',},
//   labels: { fillStyle:'rgb(0, 0, 0)', disabled:true,},
//   timestampFormatter:SmoothieChart.timeFormatter,
// });
// smoothie.streamTo(document.getElementById("mycanvas"));
// // Data
// var line1 = new TimeSeries();
// var line2 = new TimeSeries();

// Add a random value to each line every second
// setInterval(function() {
//   line1.append(new Date().getTime(), (Math.random()*0));
//   // line2.append(new Date().getTime(), (Math.random()*0));
// }, 1000);

// Add to SmoothieChart
// smoothie.addTimeSeries(line1);
// smoothie.addTimeSeries(line2);


smoothie.addTimeSeries(line1,
  { strokeStyle:'rgb(0, 255, 0)', fillStyle:'rgba(255, 255, 255, 0)', lineWidth:3 });
smoothie.addTimeSeries(line2,
  { strokeStyle:'rgb(255, 0, 0)', fillStyle:'rgba(255, 255, 255, 0)', lineWidth:3 });

// p2p 呈现下载函数
var fogSpeed = function(number) {
  var fogSpeedBtn = document.querySelector(".p2p-speed-number")
  fogSpeedBtn.innerText = ''
  // console.log('p2p-speed-show', p2pSpeedBtn)
  // var number = Math.floor(Math.random() *10)
  var html = `<span>  ${number} Kbps</span>`
  fogSpeedBtn.insertAdjacentHTML("beforeend", html)
}
// fogSpeed(0)
// setInterval(function() {p2pSpeed()}, 1000)
// setInterval(function() {p2pSpeed()}, 1000)

// http 呈现下载函数
var httpSpeed = function(number) {
  var httpSpeedBtn = document.querySelector(".http-speed-number")
  httpSpeedBtn.innerText = ''
  // console.log('p2p-speed-show', httpSpeedBtn)
  // var number = Math.floor(Math.random() *10)
  var html = `<span>  ${number} Kbps</span>`
  httpSpeedBtn.insertAdjacentHTML("beforeend", html)
}
httpSpeed(0)
// 下载呈现函数启动
var _downDataShowSpeed = function() {
  setInterval(function() {
    httpSpeed()
    fogSpeed()
  }, 1000)
}
// _downDataShowSpeed()
